<% if @orders.any? %>
  <div class="table-responsive">
    <table class="table position-relative" id="listing_orders">
      <thead class="text-muted">
        <tr>
          <th><%= I18n.t(:number, scope: 'activerecord.attributes.spree/order') %></th>
          <% if controller_name == 'orders' %>
            <th><%= sort_link @search, :completed_at,   Spree.t(:date) %></th>
          <% else %>
            <th><%= sort_link @search, :created_at,     Spree.t(:date) %></th>
          <% end %>
          <th class="d-customer"><%= Spree.t(:customer) %></th>
          <th><%= Spree.t(:fulfilled_from) %></th>
          <th><%= I18n.t(:payment_state, scope: 'activerecord.attributes.spree/order') %></th>
          <th><%= I18n.t(:shipment_state, scope: 'activerecord.attributes.spree/order') %></th>
          <th class="text-right"><%= sort_link @search, :item_count, I18n.t(:item_count, scope: 'activerecord.attributes.spree/order') %></th>
          <th class="text-right"><%= sort_link @search, :total, I18n.t(:total, scope: 'activerecord.attributes.spree/order') %></th>
        </tr>
      </thead>
      <tbody>
        <%= render collection: @orders, partial: 'spree/admin/orders/order', cached: !(defined?(current_vendor) && current_vendor) ? spree_base_cache_scope : false %>
      </tbody>
    </table>
  </div>
<% else %>
  <div class="text-muted p-5 d-flex align-items-center w-100 justify-content-center">
    <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Order)) %>
  </div>
<% end %>
<%= render 'spree/admin/shared/index_table_options', collection: @orders, simple: true if @orders.any? %>
